package demoMod.stsconsole.helpers;

import java.util.ArrayList;
import java.util.List;

public class PromptHelper {
    private static final List<String> prompt = new ArrayList<>();

    public static String getPrompt() {
        StringBuilder ret = new StringBuilder();
        for (String s : prompt) {
            ret.append(s).append("/");
        }
        return ret.toString();
    }

    public static void appendPrompt(String append) {
        prompt.add(append);
    }

    public static void backwardPrompt() {
        if (prompt.size() == 0) return;
        prompt.remove(prompt.size() - 1);
    }

    public static String getCurrentHierarchy() {
        if (!prompt.isEmpty()) {
            return prompt.get(prompt.size() - 1);
        }
        return "";
    }
}
